import { Enum } from "cc";
import { PanelConfigInfo, PrefabNameToPanelKeyMap, UIConfig, makePrefabStrToPanelKeyMap } from "../../scripts/libs/ui/UIConfig";

export namespace subgame001 {

    export enum PanelKey {
        LoadingPanel,
        MainPanel,
        DialogPanel
    }
    Enum(PanelKey);

    const subgamekey = 'subgame001';
    const assetbundle = `ab_${subgamekey}`;

    export const UIConfigList = [
        [PanelKey.LoadingPanel, {
            assetbundle, assetPath: 'Prefabs/LoadingPanel/LoadingPanel',
            tier: 'tier3',
            destroy: false, // 随场景的如果下次还需要，那么不能删
            scene: true,
            name: 'LoadingPanel',
        }],
        [PanelKey.MainPanel, {
            assetbundle, assetPath: 'Prefabs/MainPanel/MainPanel',
            tier: 'tier1',
            destroy: true,
        }],
        [PanelKey.DialogPanel, {
            assetbundle, assetPath: 'Prefabs/DialogPanel/DialogPanel',
            tier: 'tier3',
            destroy: true,
        }],
    ];

    export function init() {
        UIConfig.set(subgamekey, new Map());
        UIConfigList.forEach(_ => {
            UIConfig.get(subgamekey).set(_[0] as any, _[1] as PanelConfigInfo);
        });
        makePrefabStrToPanelKeyMap(UIConfigList as any, PrefabNameToPanelKeyMap);
    }

    init();
}

